#include "DataModel.h"
#include "SrvConnection.h"
#include "DlgAbout.h"
#include "scImpl.h"

#define FCT "DlgAbout::DlgAbout"
DlgAbout::DlgAbout(QWidget *parent) : QDialog(parent)
{
	ui.setupUi(this);
	ui.appIcon->setPixmap(QPixmap(":res/logo.png"));
	const SrvConnection * srv(DataModel::get()->getSrvConnection());
	if(srv)
	{
		QString text;
		srv->getVersionInfo(&text, NULL, NULL, NULL);
		if(text.isEmpty())
			ui.versionServerText->setText(tr("unknown"));
		else
			ui.versionServerText->setText(text);
	}
	else
		ui.versionServerText->setText(tr("unknown"));
	ostringstream os;
	os <<"V "<<VERSION_MAJOR<<"."<<VERSION_MINOR<<"."<<VERSION_BUILD;
	ui.versionClientText->setText(QString(os.str().c_str()));
}

#undef FCT
#define FCT "DlgAbout::~DlgAbout"
DlgAbout::~DlgAbout()
{
}
